package util.ourIterator;

/**
 * Created by mahanlei on 2016/11/24.
 */
public class ConcreteAggregate implements List{
    private Object[] list;
    private int size=0;
    private int index=0;
      public ConcreteAggregate(){
               index=0;
                size=0;
                list=new Object[100];
            }

     public void add(Object obj) {
                list[index++]=obj;
                size++;
             }


     public Iterator iterator() {

                 return new ConcreteIterator(this);
             }

    public Object get(int index) {

                 return list[index];
             }

     public int getSize() {

                return size;
             }

}
